import Vue from 'vue'
import VueRouter from 'vue-router'
import Router from 'vue-router'

const Home=()=>import('../views/home/Home')
const Category=()=>import('../views/category/category')
const Cart=()=>import('../views/cart/Cart')
const Profile=()=>import('../views/profile/Profile')

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '',
    redirect: '/home',
  },
  {
    path: '/home',
    component: Home,
  },
  {
    path: '/Category',
    component: Category,
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
  },
  {
    path: '/Cart',
    component: Cart,
  },
  {
    path: '/Profile',
    component: Profile,
  },
]

const router = new VueRouter({
  routes
  
})

export default router
